class Solution
{
public:
    int minimumChairs(string s)
    {
        int result = 0;
        int cur = 0;
        for (char c : s)
        {
            if (c == 'E')
            {
                ++cur;
            }
            else
            {
                --cur;
            }
            result = max(result, cur);
        }
        return result;
    }
};